/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pessoas.presenter;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import pessoas.interfaces.ConfiguraPresenter;
import pessoas.interfaces.IConfiguraViewInclusao;
import pessoas.view.InclusaoPessoaView;
import pessoas.view.MainView;

/**
 *
 * @author jakson
 */
public class MainPresenter {

    private MainView view;
    private ConfiguraPresenter confi;
    private IConfiguraViewInclusao configInclusao;

    public MainPresenter() {
        view = new MainView();
        view.getItemMenuAdicionar().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                configInclusao = new InclusaoPessoaPresenter(new InclusaoPessoaView());             
            }
        });

        view.getItemMenuListar().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                new ManterPessoaPresenter();
                
            }
        });

        view.getItemMenuSair().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                view.dispose();
            }
        });
        
        view.getItemMenuImportar().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                chamarTelaImportar();
            }
        });

        view.setSize(redimensionarView());
        view.setLocationRelativeTo(view);
        view.setVisible(true);
    }

    public Dimension redimensionarView() {
        return (new Dimension(
                (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth(),
                (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight()));
    }
    
    private void chamarTelaImportar(){
        new ImportarContatosPresenter();
    }
}
